package com.youka.bussiness.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author cai
 */
@Configuration
public class SwaggerConfig {

    // <!--swagger2整合bootstrap 访问 :server的端口/doc.html-->

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.youka.bussiness.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("开发接口文档")
                .description("xt API 接口文档")
                .termsOfServiceUrl("http://127.0.0.1:8833/doc.html")
                .contact("921819416@qq.com")
                .version("1.0.0")
                .build();
    }

}
